const { Op, where } = require("sequelize");
const sequelize = appRequire('db');
var COS = require('cos-nodejs-sdk-v5');
const bgSettingModel = appRequire('models/bgSetting');
const common = appRequire('common/common');
const thisRequest = require('sync-request');
//const axios = require('axios');
const fs = require('fs');
const path = require('path');

// 导出对象，供其它模块调用
module.exports = {
    getTemplates,
};

async function getTemplates(req, request) {
    let postData = req.body
    let returnData = Common.clone(Constant.DEFAULT_SUCCESS);

    let url = "https://poster.miaogeban.com/poster/home/type?type=1"

    var res = thisRequest('GET', url, {
        /*headers: {
            'User-Agent': 'pan.baidu.com'
        }*/
    });
    var body = res.getBody();
    var jsonObj = JSON.parse(body); // 解析接口返回的JSON内容
    jsonObj.code = 1
    return request.json(jsonObj)
}